package nowcoder.day_48.day14;

import java.util.Scanner;

public class Num1 {
    public static boolean isRun(int year) {
        if ((year % 400 == 0) || (year % 4 == 0) && (year % 100 != 0)){
            return true;
        }else {
            return false;
        }
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int year = in.nextInt();
        int month = in.nextInt();
        int day = in.nextInt();
        int sum = 0;
        switch (month){
            case 12:sum += 30;
            case 11:sum += 31;
            case 10:sum += 30;
            case 9:sum += 31;
            case 8:sum += 31;
            case 7:sum += 30;
            case 6:sum += 31;
            case 5:sum += 30;
            case 4:sum += 31;
            case 3:if (isRun(year)){
                sum += 29;
            }else {
                sum += 28;
            }
            case 2:sum += 31;
            case 1:sum += day;

        }
        System.out.println(sum);
    }
}
